package com.ymatou.iapi.sellerproduct.service;

import java.math.BigDecimal;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import com.ymatou.iapi.productitem.service.GetProductInfoByProductIdCall;
import com.ymt.core.tool.Logger;
import com.ymttest.business.YmatouAutoTestCall;
import com.ymttest.business.service.AssertService;
import com.ymttest.database.model.YmtCatalogsI;
import com.ymttest.database.model.YmtPictures;
import com.ymttest.database.model.YmtProductsI;
import com.ymttest.database.mongo.ProductDescriptionModelWapper;
import com.ymttest.database.mongo.ProductDetailModelWapper;
import com.ymttest.database.mongo.ProductListingModelWapper;
import com.ymttest.database.mongo.YmtMongoDriverFactroy;
import com.ymttest.database.mongo.jproduct.ProductsWapper;
import com.ymttest.database.sqlwapper.YmtCatalogsIWapper;
import com.ymttest.database.sqlwapper.YmtPicturesWapper;
import com.ymttest.database.sqlwapper.YmtProductBrandWapper;
import com.ymttest.database.sqlwapper.YmtProductCategoryWapper;
import com.ymttest.database.sqlwapper.YmtProductDescriptionWapper;
import com.ymttest.database.sqlwapper.YmtProductLimitNumHistory;
import com.ymttest.database.sqlwapper.YmtProductsIWapper;
import com.ymttest.database.sqlwapper.YmtSellerInfoWapper;
import com.ymttest.utils.EnvSetup;
import com.ymttest.utils.JsonBeanHelper;
import com.ymttest.utils.YMTDateUtil;
/**
*添加长期售卖商品Call
*FreeMaker Template自动生成代码
*/
public class AddNewSellerProductCall extends YmatouAutoTestCall{
	private static String opurl ="/api/SellerProduct/AddNewSellerProduct";
	
	public AddNewSellerProductCall() {
		super(EnvSetup.getSystemUrl("sellerproduct_iapi"),opurl,"POST","JSON");
	}
	@Override
	public void addDefHeader() {
		client.addHeader("Content-Type", "application/json; charset=UTF-8");
	}
	
	
	
	public void callService(){
		try {
			super.callService();
			String productId = new JSONObject(super.getReturnData()).getJSONObject("Data").getString("ProductID");
			//new ProductsWapper().getByProductId(productId);
		} catch (Exception e) {
			e.printStackTrace();
		}
		
		
		
		
		
	}
	
	
	public JSONObject callAndGetReturnDataAndMgoNoCheck(JSONObject jsonBean) {

		JSONObject ret = super.callAndGetReturnData(jsonBean);
		try {
			String productId = ret.getJSONObject("Data").getString("ProductID");
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		return ret;
	}

	
	
	public JSONObject callAndGetReturnData(JSONObject jsonBean) {

		JSONObject ret = super.callAndGetReturnData(jsonBean);
		try {
			String productId = ret.getJSONObject("Data").getString("ProductID");
			//new ProductsWapper().getByProductId(productId);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		return ret;
	}

	
	
	/**
	 * ---------------------------创建测试数据部分------------------------------------
	 */

	
	
		
	/**
	 * 发布一个双规格商品
	 * 取出商品ID：String productId = result.getJSONObject("Data").getString("ProductID");
	 * @param updateMap
	 * @return 返回请求&返回报文
	 * @throws Exception
	 */
	public static JSONObject addNewProductTWOCatalog(Map<String, Object> updateMap) throws Exception{
		JSONObject addProductBean = JsonBeanHelper.getJsonBean("com.ymatou.iapi.sellerproduct/AddNewSellerProduct/AddNewProductTpl_Tc1.json");
		updateMap.put("Product->ProductName", "自动化测试_立即上架现货商品 "+YMTDateUtil.getSysTime());
		JsonBeanHelper.updateJsonBean(addProductBean, updateMap);
		return new AddNewSellerProductCall().callAndGetReturnData(addProductBean);
	}
	
	
	
	/**
	 * 添加长期售卖商品（2种分类4个规格）
	 * 取出商品ID：String productId = result.getJSONObject("Data").getString("ProductID");
	 * @param updateMap
	 * @return 返回请求&返回报文
	 * @throws Exception
	 */
	public static JSONObject addNewProductFourCatalog(Map<String, Object> updateMap) throws Exception{
		JSONObject addProductBean = JsonBeanHelper.getJsonBean("com.ymatou.iapi.sellerproduct/AddNewSellerProduct/AddNewProductTpl_Tc3.json");
		updateMap.put("Product->ProductName", "自动化测试_立即上架现货商品 "+YMTDateUtil.getSysTime());
		JsonBeanHelper.updateJsonBean(addProductBean, updateMap);
		return new AddNewSellerProductCall().callAndGetReturnData(addProductBean);
	}
	
	
	
	
	
	
	
	
	/**
	 * ---------------------------断言部分------------------------------------
	 */

	/**
	 * 新增商品断言
	 * @param jsonObjectBean 发布商品请求报文
	 * @param productID 商品id
	 * @return 
	 * @throws Exception
	 */
	public static void checkNewProduct(JSONObject jsonObjectBean,String productID) throws Exception {
	    try {
	    	//取出请求报文的参数
	    	JSONObject productObject=  jsonObjectBean.getJSONObject("Product");
	    	JSONObject productDescriptionInfoObject = productObject.getJSONObject("ProductDescriptionInfo");
	    	JSONObject catalogs0 = productObject.getJSONArray("Catalogs").getJSONObject(0);
	    	
	    	int userid=(int) jsonObjectBean.getInt("UserID");
	    	String loginId=(String) jsonObjectBean.getString("LoginID");
	    	String productname=(String) productObject.getString("ProductName");	//商品名
	    	String mobileDescription=(String) productObject.getString("MobileDescription");	//移动端商品描述
	    	String pictureUrl=(String) productDescriptionInfoObject.getJSONArray("Pictures").getJSONObject(0).get("PictureUrl");
	    	String picturl=(String) productObject.getString("PictureUrl1");	//商品图片
	    	String wordContent=(String) productDescriptionInfoObject.getString("WordContent"); 	//商品描述	    	
	    	boolean limited=(boolean) productObject.getBoolean("Limited");		//是否限购	    	
	    	int limitnum=(int) productObject.getInt("LimitNum");		//限购数量
	    	int iCatalogType=(int) productObject.getInt("CatalogType");	//2FBX商品
	    	int iCatalogStatus=(int) productObject.getInt("CatalogStatus");	//3FBX海外仓 5FBX保税仓
	    	String limitNumStartTime=String.format("{0:d}", (String) productObject.getString("LimitNumStartTime"));	//限购开始时间	    	
	    	boolean noticeRisk=(boolean) productObject.getBoolean("NoticeRisk");	//砍单风险	
	    	int logisticsChannel=(int) productObject.getInt("LogisticsChannel");	//物流方式
		    	if (iCatalogType ==2 & iCatalogStatus==3) {		
		    		logisticsChannel=7;		//FBX贝海直邮=7
				}else if (iCatalogType ==2 & iCatalogStatus==5) {
					logisticsChannel=8;		//FBX贝海直邮=8
				}	    	
	    	int tariffType=(int) productObject.getInt("TariffType");	//包税	    	
	    	int onSaleType=(int) productObject.getInt("OnSaleType");	//上架状态
	    	int localReturn=(int) productObject.getInt("LocalReturn");		//1官方退货 2买手本土退货
	    	boolean noReasonReturn=(boolean) productObject.getBoolean("NoReasonReturn");	//无理由退货
	    	int iCategoryId=(int) productObject.getInt("iCategoryId");	//商品类目
	    	int iThirdCategoryId=(int) productObject.getInt("iThirdCategoryId");	//三级类目
	    	int iBrandId=(int) productObject.getInt("iBrandId");	//商品品牌
	    	String description=(String) productObject.getString("Description");	//老商品详情描述
	    	
	    	
		    //SQL取值
		    //Ymt_Products
		    YmtProductsIWapper ymtProductsIWapper = new YmtProductsIWapper();
		    List<YmtProductsI> rm1 = ymtProductsIWapper.selectProductByProductId(productID);
		    String sProductbysql = rm1.get(0).getsProduct();		//商品名称
		    String sMobileDescriptionbysql = rm1.get(0).getsMobileDescription(); 	//移动端商品描述
		    int iLocalReturnbysql = rm1.get(0).getiLocalReturn(); 	//退货方式
		    boolean bNoticeRiskbysql = rm1.get(0).getbNoticeRisk(); 	//砍单风险
		    int iTariffTypebysql = rm1.get(0).getiTariffType(); 	//关税
		    int iLogisticsChannelbysql = rm1.get(0).getiLogisticsChannel(); 	//物流方式
		    boolean bNoReasonReturnbysql = rm1.get(0).getbNoReasonReturn(); 	//无理由退货	
		    int iCategoryIdbysql = rm1.get(0).getiCategoryId(); //商品类目id
		    int iThirdCategoryIdbysql = rm1.get(0).getiThirdCategoryId(); 	//三级类目id
		    int iBrandIdbysql = rm1.get(0).getiBrandId();		//品牌id		    
		    int iUserIdbyProduct = rm1.get(0).getiUserId();		//用户id
		    int iLimitNumbysql = rm1.get(0).getiLimitNum();		//限购数
		    String dLimitNumStartTimebysql = String.format("{0:d}", rm1.get(0).getdLimitNumStartTime().toString());	//限购开始时间
	        //Ymt_Pictures
	        YmtPicturesWapper ymtPicturesWapper = new YmtPicturesWapper();	                 
	    	List<YmtPictures> ymtPictures = ymtPicturesWapper.selectPicturesBysKey(productID);
	    	String productPicurlbysql1 = ymtPictures.get(0).getSurl(); 	//图片表地址
	        //Ymt_ProductPicture
	    	YmtCatalogsIWapper ymtCatalogsIWapper = new YmtCatalogsIWapper();  
	        List<Map> rm3 = ymtCatalogsIWapper.selectProductPictureByProductId(productID);
	        String sProductPicturebysql = (String) rm3.get(0).get("sOriUrl");	//商品图片表地址
	        //Ymt_ProductDescConfigWord
	        List<Map> rm4 = ymtCatalogsIWapper.selectProductDescConfigWordByProductId(productID);
	        String sWordContentbysql = (String) rm4.get(0).get("WordContent");	//商品详细描述 
	        //Ymt_ProductDescription	老商品详情表
	    	YmtProductDescriptionWapper ymtProductDescriptionWapper = new YmtProductDescriptionWapper();	                 
	        String sProductDescriptionbysql = ymtProductDescriptionWapper.selectProductDescriptionByProductId(productID);
	        //Ymt_ProductLimitNumHistory 历史限购表
	    	YmtProductLimitNumHistory ymtProductLimitNumHistory = new YmtProductLimitNumHistory();           
	    	List<Map>  iLimitNumHistory = ymtProductLimitNumHistory.selectLimitNumHistoryByProductId(productID);
	    	int iLimitNumbysqlHistory = (int) iLimitNumHistory.get(0).get("iLimitNum");		//历史限购数
	    	String dLimitNumStartTimebysqlHistory = String.format("{0:d}",((Date) iLimitNumHistory.get(0).get("dLimitStartTime")).toString());	//历史限购表 限购开始时间

	        
	        //SQL断言
	        Logger.verifyEquals(productname, sProductbysql, "SQL商品名称对比");
	        Logger.verifyEquals(mobileDescription, sMobileDescriptionbysql, "SQL移动端描述对比");
	        Logger.verifyEquals(wordContent, sWordContentbysql, "SQL详细描述对比");
	        Logger.verifyEquals(picturl, sProductPicturebysql, "SQL商品图片地址对比");
	        Logger.verifyEquals(picturl, productPicurlbysql1, "Ymt_Pictures商品图片地址对比");
	        Logger.verifyEquals(localReturn, iLocalReturnbysql, "SQL退货方式对比");
	        Logger.verifyEquals(noticeRisk, bNoticeRiskbysql, "SQL砍单风险对比");
	        Logger.verifyEquals(tariffType, iTariffTypebysql, "SQL是否包税对比");
	        Logger.verifyEquals(logisticsChannel, iLogisticsChannelbysql, "SQL物流方式对比");
	        Logger.verifyEquals(noReasonReturn, bNoReasonReturnbysql, "SQL无理由退货对比");
	        Logger.verifyEquals(iCategoryId, iCategoryIdbysql, "SQL商品类目id对比");
	        Logger.verifyEquals(iThirdCategoryId, iThirdCategoryIdbysql, "SQL三级类目id对比");
	        Logger.verifyEquals(iBrandId, iBrandIdbysql, "SQL品牌id对比");
	        Logger.verifyEquals(iBrandId, iBrandIdbysql, "Ymt_Pictures商品图片地址对比");
	        Logger.verifyEquals(description, sProductDescriptionbysql, "Ymt_ProductDescription老商品详情对比");	
	        Logger.verifyEquals(userid, iUserIdbyProduct, "Ymt_Products表用户id对比");	
	        Logger.verifyEquals(limitnum, iLimitNumbysql, "限购数对比");	
	        Logger.verifyEquals(limitnum, iLimitNumbysqlHistory, "历史限购数对比");
	        Logger.verifyEquals(limitNumStartTime, dLimitNumStartTimebysql, "限购开始时间对比");
	        Logger.verifyEquals(limitNumStartTime, dLimitNumStartTimebysqlHistory, "历史限购开始时间对比");
	        
	        if (YmtMongoDriverFactroy.isOldMongoCheck()){
		    //Mongo取值
	        JSONObject aa=GetProductInfoByProductIdCall.GetProductInfoByProductId(productID);
			JSONObject data = aa.getJSONObject("Data").getJSONObject("Product");
			JSONObject sProductlist = data.getJSONObject("Product");
			JSONObject sCatalogStockList = data.getJSONArray("CatalogStockList").getJSONObject(0);
			
			String sProductIdbyMongo = sProductlist.getString("ProductId");	//商品id
			String sProductTitlebyMongo = sProductlist.getString("ProductTitle");	//商品名称
			String sProductIntroductionbyMongo = sProductlist.getString("ProductIntroduction");	//移动端描述
			BigDecimal sPricebyMongo = new BigDecimal(sCatalogStockList.getString("Price")).setScale(2, BigDecimal.ROUND_HALF_UP);	//商品价格
			BigDecimal sVipPricebyMongo = new BigDecimal(sCatalogStockList.getString("VipPrice")).setScale(2, BigDecimal.ROUND_HALF_UP);	//商品价格
			BigDecimal sNewGuestPricebyMongo = new BigDecimal(sCatalogStockList.getString("NewGuestPrice")).setScale(2, BigDecimal.ROUND_HALF_UP);	//商品价格
			int sStockNumbyMongo = sCatalogStockList.getInt("StockNum");	//商品数量
			String sSKUbyMongo = sCatalogStockList.getString("SKU");	//商品SKU
			String sLivePic2byMongo = sProductlist.getJSONArray("LivePicList").getString(0);	//商品图片2地址
			int sLocalReturnbyMongo = sProductlist.getInt("LocalReturn");	//退货方式
			boolean bNoticeRiskbyMongo = sProductlist.getBoolean("NoticeRisk"); 	//砍单风险
			int sTariffTypebyMongo = sProductlist.getInt("TariffType");	//是否包税
			int sLogisticsChannelbyMongo = sProductlist.getInt("LogisticsChannel");	//物流方式
			boolean bNoReasonReturnbyMongo = sProductlist.getBoolean("IsNoReasonReturn"); 	//无理由退货
			int iCategoryIdbyMongo = sProductlist.getInt("CategoryId"); 	//商品类目
			int iThirdCategoryIdbyMongo = sProductlist.getInt("ThirdCategoryId"); 	//三级类目
			int iBrandIdbyMongo = sProductlist.getInt("BrandId"); 	//品牌id		
			int sellerIdbyMongo = sProductlist.getInt("SellerId"); 	//用户id	
			String sellerNamebyMongo = sProductlist.getString("SellerName"); 	//用户名
			int iLimitNumbyMongo = sProductlist.getInt("LimitNum");		//限购数
			String dLimitNumStartTimebyMongo = String.format("{0:d}", sProductlist.getString("LimitNumStartTime"));  	//限购开始时间
			int iFreightbyMongo = sProductlist.getInt("Freight");		//运费
			
	        //Mongo断言
			Logger.verifyEquals(productID, sProductIdbyMongo, "Mongo商品id对比");
	        Logger.verifyEquals(productname, sProductTitlebyMongo, "Mongo商品名称对比");
	        Logger.verifyEquals(mobileDescription, sProductIntroductionbyMongo, "Mongo移动端描述对比");
	        Logger.verifyEquals(picturl, sLivePic2byMongo, "Mongo商品图片2地址对比");
	        Logger.verifyEquals(localReturn, sLocalReturnbyMongo, "Mongo退货方式对比");
	        Logger.verifyEquals(noticeRisk, bNoticeRiskbyMongo, "Mongo砍单风险对比");
	        Logger.verifyEquals(tariffType, sTariffTypebyMongo, "Mongo是否保税对比");
//	        Logger.verifyEquals(logisticsChannel, sLogisticsChannelbyMongo, "Mongo物流方式对比");
	        Logger.verifyEquals(noReasonReturn, bNoReasonReturnbyMongo, "Mongo无理由退货对比");
	        Logger.verifyEquals(iCategoryId, iCategoryIdbyMongo, "Mongo商品类目对比");
	        Logger.verifyEquals(iThirdCategoryId, iThirdCategoryIdbyMongo, "Mongo三级类目对比");
	        Logger.verifyEquals(iBrandId, iBrandIdbyMongo, "Mongo品牌id对比");
	        Logger.verifyEquals(userid, sellerIdbyMongo, "Mongo用户id对比");
	        Logger.verifyEquals(loginId, sellerNamebyMongo, "Mongo用户名对比");
	        Logger.verifyEquals(limitnum, iLimitNumbyMongo, "Mongo限购数对比");	
	        Logger.verifyEquals(limitNumStartTime, dLimitNumStartTimebyMongo, "Mongo限购开始时间对比");
	        Logger.verifyEquals(0, iFreightbyMongo, "Mongo运费对比");
	        }
			
	    }catch (Exception e) {
	        e.printStackTrace();
	    }
	}
	
	
	
	/**
	 * 循环校验 所有 规格的价格、vip价格、新客价、商品数量、SKU、商品编号
	 * @param jsonObjectBean	请求报文
	 * @param productID		商品id
	 * @throws Exception
	 */
	public static void checkCatalogsprice(JSONObject jsonObjectBean,String productID) throws Exception {
	    try {
	    	//取出请求报文的参数
	    	JSONObject productObject=  jsonObjectBean.getJSONObject("Product");
	    	int catalogssize =  productObject.getJSONArray("Catalogs").length();	//规格数量

	    	int i;
	    	for( i = 0; i < catalogssize; i++){	
	    										
	    		JSONObject catalogs = productObject.getJSONArray("Catalogs").getJSONObject(i);
	    		int iactionforCatalog = catalogs.getInt("Action");	//取出报文中规格的有效状态，如果状态为-2，跳出循环
	    		if(iactionforCatalog == -2){
	    			break;
	    		}
	    		
		    	int userid=(int) jsonObjectBean.getInt("UserID");
		    	BigDecimal price= new BigDecimal (catalogs.getDouble("Price"));	//商品价格
		    	BigDecimal vipprice=new BigDecimal ( catalogs.getDouble("VipPrice"));	//VIP价格
		    	BigDecimal newcustomerprice=new BigDecimal (catalogs.getDouble("NewCustomerPrice"));	//新手价格	    	
		    	int num=(int) catalogs.getInt("Num");	//商品数量
		    	String sSKU=(String) catalogs.getString("SKU");		//SKU	    	
		    	int iCatalogType=(int) productObject.getInt("CatalogType");	//2FBX商品
		    	String sProductCode=(String) catalogs.getString("ProductCode");	//商品编号
			    	if (iCatalogType == 2) {
			    		sProductCode = null;	//FBX商品没有Productcode
					}
		    			    	
			    //Ymt_Catalogs
			    YmtCatalogsIWapper ymtCatalogsIWapper = new YmtCatalogsIWapper();           
		        List<YmtCatalogsI> catalogssql = ymtCatalogsIWapper.selectCatalogsByProductId(productID);
		        YmtCatalogsI rm2  = null;
		        for(YmtCatalogsI ymtCatalogs:catalogssql){
		        	if (ymtCatalogs.getiNum()==num){
		        		rm2 = ymtCatalogs;
		        		break;
		        	}
		        }
		        Logger.verifyNotNull(rm2, "多规格数据通过不同库存数量来区分，同时规格数据不该为空 库存数量["+num+"]");
		        BigDecimal fQuotePricebysql = rm2.getfQuotePrice();		//商品价格
		        BigDecimal fVipPricebysql = rm2.getfVipPrice();		//vip价格
		        BigDecimal fNewCustomerPricebysql = rm2.getfNewCustomerPrice();		//新手价格
		        int iNumbysql = rm2.getiNum();		//商品数量
		        String sSKUbysql = rm2.getsSKU();		//SKU
		        String sProductCodebysql = rm2.getsProductCode();		//商品编码
		        int iUserIdbyCatalog= rm2.getiUserId();		//用户id	    	
		        //SQL断言
		        Logger.verifyEquals(userid, iUserIdbyCatalog, "Ymt_Catalogs表用户id对比");	
		        Logger.verifyEquals(price.setScale(2,BigDecimal.ROUND_HALF_UP), fQuotePricebysql, "SQL商品价格对比");
		        Logger.verifyEquals(vipprice.setScale(2,BigDecimal.ROUND_HALF_UP), fVipPricebysql, "SQLVIP价格对比");
		        Logger.verifyEquals(newcustomerprice.setScale(2,BigDecimal.ROUND_HALF_UP), fNewCustomerPricebysql, "SQL新手价格对比");
		        Logger.verifyEquals(num, iNumbysql, "SQL商品数量对比");
		        Logger.verifyEquals(sSKU, sSKUbysql, "SQLSKU对比");
		        Logger.verifyEquals(sProductCode, sProductCodebysql, "SQL商品编码对比");
		        
		        if (YmtMongoDriverFactroy.isOldMongoCheck()){
				    //Mongo取值
			        JSONObject aa=GetProductInfoByProductIdCall.GetProductInfoByProductId(productID);
			        JSONArray CatalogStockListBean = aa.getJSONObject("Data").getJSONObject("Product").getJSONArray("CatalogStockList");
					
					JSONObject sCatalogStockList = null;
					
					for(int k=0;k<CatalogStockListBean.length();k++){
						if (CatalogStockListBean.getJSONObject(k).getInt("StockNum")==num){
							sCatalogStockList = CatalogStockListBean.getJSONObject(k);
							break;
						}
					}
					
					Logger.verifyNotNull(sCatalogStockList, "多规格数据通过不同库存数量来区分，同时规格数据不该为空 库存数量["+num+"]");
					
					
					BigDecimal sPricebyMongo = new BigDecimal(sCatalogStockList.getString("Price")).setScale(2, BigDecimal.ROUND_HALF_UP);	//商品价格
					BigDecimal sVipPricebyMongo = new BigDecimal(sCatalogStockList.getString("VipPrice")).setScale(2, BigDecimal.ROUND_HALF_UP);	//商品价格
					BigDecimal sNewGuestPricebyMongo = new BigDecimal(sCatalogStockList.getString("NewGuestPrice")).setScale(2, BigDecimal.ROUND_HALF_UP);	//商品价格
					int sStockNumbyMongo = sCatalogStockList.getInt("StockNum");	//商品数量
					String sSKUbyMongo = sCatalogStockList.getString("SKU");	//商品SKU
			        //mang断言
			        Logger.verifyEquals(price.setScale(2,BigDecimal.ROUND_HALF_UP), sPricebyMongo, "Mongo商品价格对比");
			        Logger.verifyEquals(vipprice.setScale(2,BigDecimal.ROUND_HALF_UP), sVipPricebyMongo, "MongoVIP价格对比");
			        Logger.verifyEquals(newcustomerprice.setScale(2,BigDecimal.ROUND_HALF_UP), sNewGuestPricebyMongo, "Mongo新手价格对比");
			        Logger.verifyEquals(num, sStockNumbyMongo, "Mongo商品数量对比");
			        Logger.verifyEquals(sSKU, sSKUbyMongo, "MongoSKU对比");	    		
		        }	        
		        
	    	}	    		    		    		    		        	        
	    }catch (Exception e) {
	        e.printStackTrace();
	    }
	}
	
	
	/**
	 * 循环校验 所有 规格的规格名称、图标（多规格）
	 * @param jsonObjectBean	请求报文
	 * @param productID		商品id
	 * @throws Exception
	 */
	public static void checkCatalogsname(JSONObject jsonObjectBean,String productID) throws Exception {
	    try {
		    YmtCatalogsIWapper ymtCatalogsIWapper = new YmtCatalogsIWapper(); 
	    	//取出请求报文的参数
	    	JSONObject productObject=  jsonObjectBean.getJSONObject("Product");
	    	int catalogssize =  productObject.getJSONArray("Catalogs").length();	//取出报文中规格数量

		    	int i;		//循环执行，断言所有规格
		    	for( i = 0; i < catalogssize; i++){	
		    		//请求报文中的Catalog
		    		JSONObject catalogs = productObject.getJSONArray("Catalogs").getJSONObject(i);
		    		//取出报文中规格的有效状态，如果状态为-2，跳出循环
		    		int iactionforCatalog = catalogs.getInt("Action");	
		    		if(iactionforCatalog == -2){
		    			break;
		    		}

				        //规格check
			    		int propertyValuessize = catalogs.getJSONArray("PropertyValues").length();	//如果规格是双品种（比如颜色+尺寸的情况）执行if，否执行else
				        if (propertyValuessize == 2 ) {
				        	JSONObject propertyValues0 = catalogs.getJSONArray("PropertyValues").getJSONObject(0);
				        	JSONObject propertyValues1 = catalogs.getJSONArray("PropertyValues").getJSONObject(1);
				        	
				        	String propertyName0 = propertyValues0.getString("PropertyName");	//规格1名称
				        	String propertyValue0 = propertyValues0.getJSONArray("PropertyValues").getJSONObject(0).getString("PropertyValue");		//规格1的值
				        	String attributeUrl0 = propertyValues0.getJSONArray("PropertyValues").getJSONObject(0).getString("AttributeUrl");	//规格1图标地址
				        	String propertyName1 = propertyValues1.getString("PropertyName");	//规格2名称
				        	String propertyValue1 = propertyValues1.getJSONArray("PropertyValues").getJSONObject(0).getString("PropertyValue");		//规格2的值
				        	String attributeUrl1 = propertyValues1.getJSONArray("PropertyValues").getJSONObject(0).getString("AttributeUrl");	//规格2图标地址
				        	
				        	//sql
				        	Map m = new HashMap();
					    	m.put("propertyName0", propertyName0);
					    	m.put("propertyName1", propertyName1);
					    	m.put("sProductId", productID);
					        List<Map> ret = ymtCatalogsIWapper.selectCatalognamesfortwologs(m);			        
					        //如果没有规格图标的情况下执行if，否则执行else
					        if (ret.get(i).get("sPicUrl") == null) {
						        Logger.verifyIsContains(attributeUrl0, ret, "sql包含规格图标"+i);
						        Logger.verifyIsContains(attributeUrl1, ret, "sql包含规格图标"+i);
							}else {
						        Logger.verifyIsContains(attributeUrl0, ret, "sql包含规格图标"+i);
						        Logger.verifyIsContains(attributeUrl1, ret, "sql包含规格图标"+i);
							}
					        
					        Logger.verifyIsContains(propertyValue0, ret, "sql包含规格"+i);
					        Logger.verifyIsContains(propertyValue1, ret, "sql包含规格"+i);
					     
					        
					        if (YmtMongoDriverFactroy.isOldMongoCheck()){     
					        //Mongo
					        JSONObject aa=GetProductInfoByProductIdCall.GetProductInfoByProductId(productID);
							JSONObject data = aa.getJSONObject("Data").getJSONObject("Product");
							JSONObject catalogProperty = data.getJSONObject("CatalogProperty");	
							String productidbyMongo = catalogProperty.getString("ProductId");
							JSONArray propertyList = catalogProperty.getJSONArray("PropertyList");
							Logger.verifyEquals(productID, productidbyMongo, "Mongo规格的商品id对比"+i);
							Logger.verifyIsContains(propertyValue0, propertyList, "Mongo包含规格"+i);
							Logger.verifyIsContains(propertyValue1, propertyList, "Mongo包含规格"+i);
					        }
					         
						}else {
				        	JSONObject propertyValues0 = catalogs.getJSONArray("PropertyValues").getJSONObject(0);
				        	
				        	String propertyName0 = propertyValues0.getString("PropertyName");	//规格1名称
				        	String propertyValue0 = propertyValues0.getJSONArray("PropertyValues").getJSONObject(0).getString("PropertyValue");		//规格1的值
				        	String attributeUrl0 = propertyValues0.getJSONArray("PropertyValues").getJSONObject(0).getString("AttributeUrl");
				        	//sql
				        	Map m = new HashMap();
					    	m.put("propertyName0", propertyName0);
					    	m.put("sProductId", productID);
					        List<Map> ret = ymtCatalogsIWapper.selectCatalognamesforonelogs(m);
//			        		String sCatalogId = (String) ret.get(i).get("sCatalogId");			        
					        //如果没有规格图标的情况下执行if，否则执行else
					        if (ret.get(i).get("sPicUrl") == null) {
						        Logger.verifyIsContains(attributeUrl0, ret, "sql包含规格图标"+i);
							}else {
						        Logger.verifyIsContains(attributeUrl0, ret, "sql包含规格图标"+i);
							}
					        Logger.verifyIsContains(propertyValue0, ret, "sql包含规格"+i); 
					        
					        if (YmtMongoDriverFactroy.isOldMongoCheck()){
					        //Mongo
					        JSONObject aa=GetProductInfoByProductIdCall.GetProductInfoByProductId(productID);
							JSONObject data = aa.getJSONObject("Data").getJSONObject("Product");
							JSONObject catalogProperty = data.getJSONObject("CatalogProperty");	
							String productidbyMongo = catalogProperty.getString("ProductId");
							JSONArray propertyList = catalogProperty.getJSONArray("PropertyList");
							Logger.verifyEquals(productID, productidbyMongo, "Mongo规格的商品id对比"+i);
							Logger.verifyIsContains(propertyValue0, propertyList, "Mongo包含规格"+i);
					        }
						}
		        	        
	    	}	    		    		    		    		        	        
	    }catch (Exception e) {
	        e.printStackTrace();
	    }
	}
	
	
	
	
	

	
	

	
	

	
	
	
	/**
	 * AddLiveProduct接口适用
	 * 取jsonObjectBean的实例(多规格场景下，SKU不能相同)
	 * JSONObject jsonObjectBean  = new AddNewSellerProductCall().callAndGetReturnData(jsonbean); 
	 * 
	 * 校验新Mongo3张表 （ProductDetailModel、ProductDescriptionModel、ProductListingModel） 
	 * 
	 * 发布商品 新Mongo断言
	 * @param jsonObjectBean 返回+请求报文集合
	 * @param productID 商品id
	 * @param sellerId 用户id
	 * @throws Exception
	 */
	public static void checkNewMongoLiveProductModel(JSONObject jsonObjectBean,String productID,int sellerId) throws Exception {
	    try {
	    	
		    	/**
				 * ProductDetailModel表
				 */
		    	Map<String, String> newMongoMap= new HashMap<String, String>();
		    	newMongoMap.put("Data->ProductId", "ProductId");
		    	newMongoMap.put("JsonBeanRequest->Product->ProductName", "Title");
		    	newMongoMap.put("JsonBeanRequest->Product->MobileDescription", "Introduction");
		    	newMongoMap.put("JsonBeanRequest->Product->ProductPics[0]", "PicList[0]");
		    	newMongoMap.put("JsonBeanRequest->Product->LimitNum", "LimitNum");
		    	newMongoMap.put("JsonBeanRequest->UserId", "SellerId");
		    	newMongoMap.put("JsonBeanRequest->LoginId", "SellerName");
		    	newMongoMap.put("JsonBeanRequest->Product->iBrandId", "BrandId");
		    	newMongoMap.put("JsonBeanRequest->Product->CatalogType", "CatalogType");
		    	newMongoMap.put("JsonBeanRequest->Product->DeliveryTemplateId", "DeliveryTemplateId");
		    	newMongoMap.put("JsonBeanRequest->Product->TariffType", "TariffType");
		    	newMongoMap.put("JsonBeanRequest->Product->Catalogs[0]->Action", "Action");
		    	newMongoMap.put("JsonBeanRequest->Product->LocalReturn", "LocalReturn");
		    	newMongoMap.put("JsonBeanRequest->Product->NoticeRisk", "NoticeRisk");
		    	newMongoMap.put("JsonBeanRequest->Product->NoReasonReturn", "NoReasonReturn");
		    			  	    	
				//Mongo 新库
				ProductDetailModelWapper productDetailModelWapper = new ProductDetailModelWapper();
				Logger.verifyEquals(1, productDetailModelWapper.getCountByProductId(productID), "商品数据应该只有1条");

				Map<String, Object> productDetailModelMap = productDetailModelWapper.getProductId(productID);
				//断言
				AssertService.assertResultEqual(newMongoMap,jsonObjectBean,productDetailModelMap);			

				
				
				//上架下架时间
				if ("null".equals(jsonObjectBean.getJSONObject("JsonBeanRequest").getJSONObject("Product").getString("ValidEnd"))) {
					AssertService.assertTime(YMTDateUtil.getDate(), (Date)productDetailModelMap.get("ValidStart"), 1000);
					AssertService.assertTime(YMTDateUtil.getBeforeOrNextDate(7), (Date)productDetailModelMap.get("ValidEnd"), 1000);
				}else {
					Date sValidStart = YMTDateUtil.parseYMDHMSDate(jsonObjectBean.getJSONObject("JsonBeanRequest").getJSONObject("Product").getString("ValidStart"));
					Date sValidEnd = YMTDateUtil.parseYMDHMSDate(jsonObjectBean.getJSONObject("JsonBeanRequest").getJSONObject("Product").getString("ValidEnd"));
					
					AssertService.assertTime(sValidStart, (Date)productDetailModelMap.get("ValidStart"), 1000);
					AssertService.assertTime(sValidEnd, (Date)productDetailModelMap.get("ValidEnd"), 1000);
				}
				
				//限购开始时间
				if (!"null".equals(jsonObjectBean.getJSONObject("JsonBeanRequest").getJSONObject("Product").getString("LimitNumStartTime"))) {
					Date sLimitNumStartTime = YMTDateUtil.parseYMDHMSDate(jsonObjectBean.getJSONObject("JsonBeanRequest").getJSONObject("Product").getString("LimitNumStartTime"));
					AssertService.assertTime(sLimitNumStartTime, (Date)productDetailModelMap.get("LimitNumStartTime"), 1000);
				}
				
				//添加商品时间
				AssertService.assertTime(YMTDateUtil.getDate(), (Date)productDetailModelMap.get("AddTime"), 1000);
										
				int iBrandId = jsonObjectBean.getJSONObject("JsonBeanRequest").getJSONObject("Product").getInt("iBrandId") ;		//品牌ID
				int iThirdCategoryId =  jsonObjectBean.getJSONObject("JsonBeanRequest").getJSONObject("Product").getInt("iThirdCategoryId") ;	//三级类目ID

				
				//商品类目
				YmtProductCategoryWapper ymtProductCategoryWapper = new YmtProductCategoryWapper();
				
				Map<String, Object> ret = ymtProductCategoryWapper.getProductCategoryByCategoryId(iThirdCategoryId).get(0);
				int iCategoryId = Integer.parseInt(ret.get("iMasterCategory").toString());
				
				ret = ymtProductCategoryWapper.getProductCategoryByCategoryId(iCategoryId).get(0);
				int iMasterCategoryid = Integer.parseInt(ret.get("iMasterCategory").toString());
				
				String sCategoryNamebySql = (String) ymtProductCategoryWapper.getProductCategoryByCategoryId(iCategoryId).get(0).get("sCategory");
				String sThirdCategoryNamebySql = (String) ymtProductCategoryWapper.getProductCategoryByCategoryId(iThirdCategoryId).get(0).get("sCategory");
				String sMasterCategoryNamebySql = (String) ymtProductCategoryWapper.getProductCategoryByCategoryId(iMasterCategoryid).get(0).get("sCategory");
					
				//品牌
				List<Map> productBrand = new YmtProductBrandWapper().getProductBrandByBrandId(iBrandId);
				
				//用户国家
				int iCountrybySql = (int) new YmtSellerInfoWapper().getSellerInfoBySellerId(sellerId).get(0).get("iCountry");

				//Ymt_Products表
				YmtProductsIWapper ymtProductsIWapper = new YmtProductsIWapper();
				int iCatalogStatus = ymtProductsIWapper.selectProductByProductId(productID).get(0).getiCatalogStatus();
				boolean isTop = (boolean) ymtProductsIWapper.selectProductByProductIdforMap(productID).get(0).get("isTop");	
				boolean isNew = (boolean) ymtProductsIWapper.selectProductByProductIdforMap(productID).get(0).get("isNew");					
				
//				//SQL取出 首次露出时间、新品结束时间	
//				Date dListingTime = YMTDateUtil.parseYMDHMSDate(ymtProductsIWapper.selectProductByProductIdforMap(productID).get(0).get("dListingTime").toString());
//				Date dNewEndtime = YMTDateUtil.parseYMDHMSDate(ymtProductsIWapper.selectProductByProductIdforMap(productID).get(0).get("dNewEndtime").toString());
				
				//保税区
				int iBondedArea = 0 ;	
				if (!"null".equals(jsonObjectBean.getJSONObject("JsonBeanRequest").getJSONObject("Product").getString("BondedArea"))){
					iBondedArea = jsonObjectBean.getJSONObject("JsonBeanRequest").getJSONObject("Product").getInt("BondedArea");
				}	
				
				//运费
				String iWeight = "0.00" ;	
				if (!"null".equals(jsonObjectBean.getJSONObject("JsonBeanRequest").getJSONObject("Product").getString("Weight"))){
					iWeight = jsonObjectBean.getJSONObject("JsonBeanRequest").getJSONObject("Product").getString("Weight");
				}
				
				//Ymt_Catalogs表
				YmtCatalogsIWapper ymtCatalogsIWapper = new YmtCatalogsIWapper();
				BigDecimal maxfQuotePrice = ((BigDecimal) ymtCatalogsIWapper.selectMaxfQuotePrice(productID).get(0).get("MaxPrice")).setScale(2, BigDecimal.ROUND_HALF_UP);//最大单价
				BigDecimal minfQuotePrice = ((BigDecimal) ymtCatalogsIWapper.selectMinfQuotePrice(productID).get(0).get("MinPrice")).setScale(2, BigDecimal.ROUND_HALF_UP);//最小单价
				
				//组装期待值
				Map<String, Object> tgtRetMap = new HashMap<String,Object>();
				tgtRetMap.put("BrandName", (String) productBrand.get(0).get("sBrand"));		//品牌英文名
				tgtRetMap.put("BrandEnName", (String) productBrand.get(0).get("sBrandEn"));		//品牌中文名
				tgtRetMap.put("MasterCategoryId", iMasterCategoryid);			//主类目ID
				tgtRetMap.put("MasterCategoryName", sMasterCategoryNamebySql);			//主类目名称
				tgtRetMap.put("CategoryId", iCategoryId);				//二级类目ID
				tgtRetMap.put("CategoryName", sCategoryNamebySql);				//二级类目名称
				tgtRetMap.put("ThirdCategoryId", iThirdCategoryId);				//三级类目ID
				tgtRetMap.put("ThirdCategoryName", sThirdCategoryNamebySql);				//三级类目名称
				tgtRetMap.put("CountryId", iCountrybySql);		//国家id
				tgtRetMap.put("DeliveryMethod", iCatalogStatus);	//物流方式 1国内 2海外直邮 3护航 4保税 6海外认证直邮 7海外拼邮
				tgtRetMap.put("BondedArea", iBondedArea);	//保税区
				tgtRetMap.put("IsNewDesc", true);	//是否新描述
				tgtRetMap.put("Weight", iWeight);	//运费
				tgtRetMap.put("MaxCatalogPrice", String.valueOf(maxfQuotePrice));	//最大单价
				tgtRetMap.put("MinCatalogPrice", String.valueOf(minfQuotePrice));	//最小单价													
				if (!jsonObjectBean.getJSONObject("JsonBeanRequest").getJSONObject("Product").isNull("ProductCode")) {
					String productCode = jsonObjectBean.getJSONObject("JsonBeanRequest").getJSONObject("Product").getString("ProductCode");
					tgtRetMap.put("ProductCode", productCode);
				}					
				tgtRetMap.put("IsTop", isTop);	
				tgtRetMap.put("IsNew", isNew);	
				
				AssertService.assertResultEqual(tgtRetMap, productDetailModelMap);
				//首次露出时间、新品结束时间
//				AssertService.assertTime(dListingTime, (Date)productDetailModelMap.get("NewStartTime"), 1000);
//				AssertService.assertTime(dNewEndtime, (Date)productDetailModelMap.get("NewEndTime"), 1000);
				
				//运费
				if ("null".equals(jsonObjectBean.getJSONObject("JsonBeanRequest").getJSONObject("Product").getString("productFreight"))) {
					Logger.verifyEquals("0.00", productDetailModelMap.get("Weight"), "Mongo运费对比");
				}else {
					Logger.verifyEquals(jsonObjectBean.getJSONObject("JsonBeanRequest").getJSONObject("Product").getString("productFreight"), productDetailModelMap.get("Weight"), "Mongo运费对比");
				}
				
				
				//Mongo CatalogList
				JSONArray mongoCatalogList = new JSONArray(productDetailModelMap.get("CatalogList").toString());  //Mongo 
				JSONArray sourceCatalogList = jsonObjectBean.getJSONObject("JsonBeanRequest").getJSONObject("Product").getJSONArray("Catalogs");
				
					for(int i = 0;i < mongoCatalogList.length();i ++){
						
						//获取Mongo第i条CatalogList记录
						JSONObject mongoCatalogObj = mongoCatalogList.getJSONObject(i);		
						
						//获取Mongo中的SKU
						String sku = mongoCatalogObj.getString("SKU");
						String catalogidbysql = (String) ymtCatalogsIWapper.selectCatalogsByProductIdandSku(productID, sku).get(0).get("sCatalogId");//sql取出规格id
						
						Logger.verifyEquals(catalogidbysql, mongoCatalogObj.getString("CatalogId"), "Mongo规格id对比");
						
						//根据报文+sku 返回对应的catalogs请求报文
						JSONObject sourceObj =	returnOneCatalogsbyJsonbean(jsonObjectBean, sku);
						
						
						if (jsonObjectBean.getJSONObject("JsonBeanRequest").getJSONObject("Product").getJSONArray("Catalogs").length() > 1) {
							//PropertyList 商品规格描述
							JSONArray mongoPropertyList = mongoCatalogObj.getJSONArray("PropertyList");
							for(int j = 0;j < mongoPropertyList.length();j++){
								String propertyName = sourceObj.getJSONArray("PropertyValues").getJSONObject(j).getString("PropertyName");
								String PropertyValue = sourceObj.getJSONArray("PropertyValues").getJSONObject(j).getJSONArray("PropertyValues").getJSONObject(0).getString("PropertyValue");
							
								Logger.verifyEquals(propertyName, mongoPropertyList.getJSONObject(j).get("Name"), "Mongo规格名称对比"+j);
								Logger.verifyEquals(PropertyValue, mongoPropertyList.getJSONObject(j).get("Value"), "Mongo规格值对比"+j);
							}
							
						}

															
							//PriceList 商品价格
							JSONArray mongoPriceList = mongoCatalogObj.getJSONArray("PriceList");
							for(int k = 0;k < mongoPriceList.length();k++){
								
								if (mongoPriceList.getJSONObject(k).getInt("PriceType") == 0 ) {
									BigDecimal price = new BigDecimal(sourceObj.getString("Price")).setScale(2, BigDecimal.ROUND_HALF_UP);	//报文取出商品原价
									BigDecimal pricebymongo = new BigDecimal(mongoPriceList.getJSONObject(k).getString("Price")).setScale(2, BigDecimal.ROUND_HALF_UP);
									
									Logger.verifyEquals("原价", mongoPriceList.getJSONObject(k).getString("Reason"), "Mongo商品价格类别对比"+k);
									Logger.verifyEquals(price, pricebymongo, "Mongo商品原价对比"+k);
								}
								
								
								
								else if (mongoPriceList.getJSONObject(k).getInt("PriceType") == 1) {
									BigDecimal newCustomerPrice = new BigDecimal(sourceObj.getString("NewCustomerPrice")).setScale(2, BigDecimal.ROUND_HALF_UP);	//报文取出商品新客价
									BigDecimal newCustomerPricebymongo = new BigDecimal(mongoPriceList.getJSONObject(k).getString("Price")).setScale(2, BigDecimal.ROUND_HALF_UP);
									
									Logger.verifyEquals("新客价", mongoPriceList.getJSONObject(k).getString("Reason"), "Mongo商品价格类别对比"+k);
									Logger.verifyEquals(newCustomerPrice, newCustomerPricebymongo, "Mongo商品新客价对比"+k);
								}
								
								
								
								else if (mongoPriceList.getJSONObject(k).getInt("PriceType") == 2) {
									BigDecimal vipPrice = new BigDecimal(sourceObj.getString("VipPrice")).setScale(2, BigDecimal.ROUND_HALF_UP);	//报文取出商品VIP价格
									BigDecimal vipPricebymongo = new BigDecimal(mongoPriceList.getJSONObject(k).getString("Price")).setScale(2, BigDecimal.ROUND_HALF_UP);									
									
									Logger.verifyEquals("VIP价", mongoPriceList.getJSONObject(k).getString("Reason"), "Mongo商品价格类别对比"+k);
									Logger.verifyEquals(vipPrice, vipPricebymongo, "Mongo商品VIP价对比"+k);
								}
								
								
								
								else if (mongoPriceList.getJSONObject(k).getInt("PriceType") == 5) {
									BigDecimal earnestPrice = new BigDecimal(sourceObj.getString("EarnestPrice")).setScale(2, BigDecimal.ROUND_HALF_UP);	//报文取出商品定金
									BigDecimal earnestPricebymongo = new BigDecimal(mongoPriceList.getJSONObject(k).getString("Price")).setScale(2, BigDecimal.ROUND_HALF_UP);									
									
									Logger.verifyEquals("定金价", mongoPriceList.getJSONObject(k).getString("Reason"), "Mongo商品价格类别对比"+k);
									Logger.verifyEquals(earnestPrice, earnestPricebymongo, "Mongo商品定金对比"+k);
								}
								
							}
							
							//StockList 商品库存
							JSONArray mongoStockList = mongoCatalogObj.getJSONArray("StockList");
							for(int l = 0;l < mongoStockList.length();l++){
									int stockbysourceObj = sourceObj.getInt("Num");	//报文取出商品库存
									Logger.verifyEquals(0, mongoStockList.getJSONObject(l).get("StockType"), "Mongo库存类别对比");
									Logger.verifyEquals(stockbysourceObj, mongoStockList.getJSONObject(l).get("Stock"), "Mongo库存数量对比");
								
								}	
								
							
							
					}
				
					
				
				
				
				
				
				/**
				 * ProductDescriptionModel 商品描述表
				 */
				ProductDescriptionModelWapper productDescriptionModelWapper = new ProductDescriptionModelWapper();
				Logger.verifyEquals(1, productDescriptionModelWapper.getCountByProductId(productID), "商品数据应该只有1条");
				
				Map<String,Object> productDescriptionModel= productDescriptionModelWapper.getProductId(productID);
				
				//SQL 查询商品描述
				List<Map> productDescription  = ymtProductsIWapper.selectDescConfigByProductId(productID);
				String sWordContent = (String) productDescription.get(0).get("WordContent");
				String sPictureUrl = (String) productDescription.get(0).get("PictureUrl");
				
				Logger.verifyIsContains(sWordContent, productDescriptionModel, "商品文字描述");
				Logger.verifyIsContains(sPictureUrl, productDescriptionModel, "商品图片描述");
				
				
				
				/**
				 * ProductListingModel 商品简单详情表
				 */
				ProductListingModelWapper productListingModelWapper = new ProductListingModelWapper();
				Logger.verifyEquals(1, productListingModelWapper.getCountByProductId(productID), "商品数据应该只有1条");
				//Mongo取出实际结果
				Map<String,Object> actRetMapbyproductListingModel = productListingModelWapper.getProductId(productID);
				
				//商品数量总数
				int catalogstock = (int) ymtCatalogsIWapper.selectSumStock(productID).get(0).get("");
								
				//组装期待结果
				JSONObject requestAddProduct = jsonObjectBean.getJSONObject("JsonBeanRequest");
				Map<String, Object> tgtRetMapbyproductListingModel = new HashMap<String, Object>();
				tgtRetMapbyproductListingModel.put("Title", jsonObjectBean.getJSONObject("JsonBeanRequest").getJSONObject("Product").getString("ProductName"));
				tgtRetMapbyproductListingModel.put("MainPic", jsonObjectBean.getJSONObject("JsonBeanRequest").getJSONObject("Product").getJSONArray("ProductPics").get(0));
				tgtRetMapbyproductListingModel.put("SellerId", jsonObjectBean.getJSONObject("JsonBeanRequest").getInt("UserId"));
				tgtRetMapbyproductListingModel.put("SellerName", jsonObjectBean.getJSONObject("JsonBeanRequest").getString("LoginId"));
				tgtRetMapbyproductListingModel.put("CountryId", iCountrybySql);		//国家id
				tgtRetMapbyproductListingModel.put("MaxCatalogPrice", String.valueOf(maxfQuotePrice));	//最大单价
				tgtRetMapbyproductListingModel.put("MinCatalogPrice", String.valueOf(minfQuotePrice));	//最小单价			
				tgtRetMapbyproductListingModel.put("CatalogStock", catalogstock);	//商品总数
				
				tgtRetMapbyproductListingModel.put("TariffType", requestAddProduct.getJSONObject("Product").getInt("TariffType"));	//保税
				tgtRetMapbyproductListingModel.put("DeliveryMethod", iCatalogStatus);	//物流方式
				//是否包邮取决于邮费价格
				tgtRetMapbyproductListingModel.put("IsFreeShipping",  requestAddProduct.getJSONObject("Product").getInt("Flight")==0?true:false);	//是否包邮
			
				
				AssertService.assertResultEqual(tgtRetMapbyproductListingModel, actRetMapbyproductListingModel,"ProductListingModel");
		    	
				
				//上架下架时间
				if ("null".equals(jsonObjectBean.getJSONObject("JsonBeanRequest").getJSONObject("Product").getString("ValidEnd"))) {
					AssertService.assertTime(YMTDateUtil.getDate(), (Date)actRetMapbyproductListingModel.get("ValidStart"), 1000);
					AssertService.assertTime(YMTDateUtil.getBeforeOrNextDate(7), (Date)actRetMapbyproductListingModel.get("ValidEnd"), 1000);
				}else {
					Date sValidStart = YMTDateUtil.parseYMDHMSDate(jsonObjectBean.getJSONObject("JsonBeanRequest").getJSONObject("Product").getString("ValidStart"));
					Date sValidEnd = YMTDateUtil.parseYMDHMSDate(jsonObjectBean.getJSONObject("JsonBeanRequest").getJSONObject("Product").getString("ValidEnd"));
					
					AssertService.assertTime(sValidStart, (Date)actRetMapbyproductListingModel.get("ValidStart"), 1000);
					AssertService.assertTime(sValidEnd, (Date)actRetMapbyproductListingModel.get("ValidEnd"), 1000);
				}
				
	    }catch (Exception e) {
	        e.printStackTrace();
	    }
	}	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	/**
	 * AddNewProduct 、 AddFbxProduct接口适用
	 * 取jsonObjectBean的实例(多规格场景下，SKU不能相同)
	 * JSONObject jsonObjectBean  = new AddNewSellerProductCall().callAndGetReturnData(jsonbean); 
	 * 
	 * 校验新Mongo3张表 （ProductDetailModel、ProductDescriptionModel、ProductListingModel） 
	 * 
	 * 发布商品 新Mongo断言
	 * @param jsonObjectBean 返回+请求报文集合
	 * @param productID 商品id
	 * @param sellerId 用户id
	 * @throws Exception
	 */
	public static void checkNewMongoProductModel(JSONObject jsonObjectBean,String productID,int sellerId) throws Exception {
	    try {
	    	
		    	/**
				 * ProductDetailModel表
				 */
		    	Map<String, String> newMongoMap= new HashMap<String, String>();
		    	newMongoMap.put("Data->ProductID", "ProductId");
		    	newMongoMap.put("JsonBeanRequest->Product->ProductName", "Title");
		    	newMongoMap.put("JsonBeanRequest->Product->MobileDescription", "Introduction");
		    	newMongoMap.put("JsonBeanRequest->Product->PictureUrl1", "PicList[0]");
		    	newMongoMap.put("JsonBeanRequest->Product->LimitNum", "LimitNum");
		    	newMongoMap.put("JsonBeanRequest->UserID", "SellerId");
		    	newMongoMap.put("JsonBeanRequest->LoginID", "SellerName");
		    	newMongoMap.put("JsonBeanRequest->Product->iBrandId", "BrandId");
		    	newMongoMap.put("JsonBeanRequest->Product->iCategoryId", "CategoryId");
		    	newMongoMap.put("JsonBeanRequest->Product->iThirdCategoryId", "ThirdCategoryId");
		    	newMongoMap.put("JsonBeanRequest->Product->CatalogType", "CatalogType");
		    	newMongoMap.put("JsonBeanRequest->Product->productFreight", "Freight");
		    	newMongoMap.put("JsonBeanRequest->Product->DeliveryTemplateId", "DeliveryTemplateId");
		    	newMongoMap.put("JsonBeanRequest->Product->TariffType", "TariffType");
		    	newMongoMap.put("JsonBeanRequest->Product->Catalogs[0]->Action", "Action");
		    	newMongoMap.put("JsonBeanRequest->Product->LocalReturn", "LocalReturn");
		    	newMongoMap.put("JsonBeanRequest->Product->NoticeRisk", "NoticeRisk");
		    	newMongoMap.put("JsonBeanRequest->Product->NoReasonReturn", "NoReasonReturn");
		    			  	    	
				//Mongo 新库
				ProductDetailModelWapper productDetailModelWapper = new ProductDetailModelWapper();
				Logger.verifyEquals(1, productDetailModelWapper.getCountByProductId(productID), "商品数据应该只有1条");

				Map<String, Object> productDetailModelMap = productDetailModelWapper.getProductId(productID);
				//断言
				AssertService.assertResultEqual(newMongoMap,jsonObjectBean,productDetailModelMap);			

				
				
				//上架下架时间
				if ("null".equals(jsonObjectBean.getJSONObject("JsonBeanRequest").getJSONObject("Product").getString("ValidStart"))) {
					AssertService.assertTime(YMTDateUtil.getDate(), (Date)productDetailModelMap.get("ValidStart"), 1000);
					AssertService.assertTime(YMTDateUtil.getBeforeOrNextDate(7), (Date)productDetailModelMap.get("ValidEnd"), 1000);
				}else {
					Date sValidStart = YMTDateUtil.parseYMDHMSDate(jsonObjectBean.getJSONObject("JsonBeanRequest").getJSONObject("Product").getString("ValidStart"));
					Date sValidEnd = YMTDateUtil.parseYMDHMSDate(jsonObjectBean.getJSONObject("JsonBeanRequest").getJSONObject("Product").getString("ValidEnd"));
					
					AssertService.assertTime(sValidStart, (Date)productDetailModelMap.get("ValidStart"), 1000);
					AssertService.assertTime(sValidEnd, (Date)productDetailModelMap.get("ValidEnd"), 1000);
				}
				
				//限购开始时间
				if (!"null".equals(jsonObjectBean.getJSONObject("JsonBeanRequest").getJSONObject("Product").getString("LimitNumStartTime"))) {
					Date sLimitNumStartTime = YMTDateUtil.parseYMDHMSDate(jsonObjectBean.getJSONObject("JsonBeanRequest").getJSONObject("Product").getString("LimitNumStartTime"));
					AssertService.assertTime(sLimitNumStartTime, (Date)productDetailModelMap.get("LimitNumStartTime"), 1000);
				}
				
				//添加商品时间
				AssertService.assertTime(YMTDateUtil.getDate(), (Date)productDetailModelMap.get("AddTime"), 1000);
								
												
				int iBrandId = jsonObjectBean.getJSONObject("JsonBeanRequest").getJSONObject("Product").getInt("iBrandId") ;		//品牌ID
				int iCategoryId = jsonObjectBean.getJSONObject("JsonBeanRequest").getJSONObject("Product").getInt("iCategoryId") ;		//二级类目ID
				int iThirdCategoryId =  jsonObjectBean.getJSONObject("JsonBeanRequest").getJSONObject("Product").getInt("iThirdCategoryId") ;	//三级类目ID
				boolean bisnew =  jsonObjectBean.getJSONObject("JsonBeanRequest").getJSONObject("Product").getBoolean("IsNew") ;	//IsNew
				
				//品牌
				List<Map> productBrand = new YmtProductBrandWapper().getProductBrandByBrandId(iBrandId);
				
				//商品类目
				YmtProductCategoryWapper ymtProductCategoryWapper = new YmtProductCategoryWapper();
				int iMasterCategoryid = (int) ymtProductCategoryWapper.getProductCategoryByCategoryId(iCategoryId).get(0).get("iMasterCategory");

				String sCategoryNamebySql = (String) ymtProductCategoryWapper.getProductCategoryByCategoryId(iCategoryId).get(0).get("sCategory");
				String sThirdCategoryNamebySql = (String) ymtProductCategoryWapper.getProductCategoryByCategoryId(iThirdCategoryId).get(0).get("sCategory");
				String sMasterCategoryNamebySql = (String) ymtProductCategoryWapper.getProductCategoryByCategoryId(iMasterCategoryid).get(0).get("sCategory");
								
				//用户国家
				int iCountrybySql = (int) new YmtSellerInfoWapper().getSellerInfoBySellerId(sellerId).get(0).get("iCountry");

				//Ymt_Products表
				YmtProductsIWapper ymtProductsIWapper = new YmtProductsIWapper();
				int iCatalogStatus = (int) ymtProductsIWapper.selectProductByProductIdforMap(productID).get(0).get("iCatalogStatus");
				boolean isTop = (boolean) ymtProductsIWapper.selectProductByProductIdforMap(productID).get(0).get("isTop");	
				boolean isNew = (boolean) ymtProductsIWapper.selectProductByProductIdforMap(productID).get(0).get("isNew");
				
//				//SQL取出 首次露出时间、新品结束时间	
//				Date dListingTime = YMTDateUtil.parseYMDHMSDate(ymtProductsIWapper.selectProductByProductIdforMap(productID).get(0).get("dListingTime").toString());
//				Date dNewEndtime = YMTDateUtil.parseYMDHMSDate(ymtProductsIWapper.selectProductByProductIdforMap(productID).get(0).get("dNewEndtime").toString());
				
				//保税区
				int iBondedArea = 0 ;	
				if (!"null".equals(jsonObjectBean.getJSONObject("JsonBeanRequest").getJSONObject("Product").getString("BondedArea"))){
					iBondedArea = jsonObjectBean.getJSONObject("JsonBeanRequest").getJSONObject("Product").getInt("BondedArea");
				}	
				
				//运费
				String iWeight = "0.00" ;	
				if (!"null".equals(jsonObjectBean.getJSONObject("JsonBeanRequest").getJSONObject("Product").getString("Weight"))){
					iWeight = jsonObjectBean.getJSONObject("JsonBeanRequest").getJSONObject("Product").getString("Weight");
				}
				
				//Ymt_Catalogs表
				YmtCatalogsIWapper ymtCatalogsIWapper = new YmtCatalogsIWapper();
				BigDecimal maxfQuotePrice = ((BigDecimal) ymtCatalogsIWapper.selectMaxfQuotePrice(productID).get(0).get("MaxPrice")).setScale(2, BigDecimal.ROUND_HALF_UP);//最大单价
				BigDecimal minfQuotePrice = ((BigDecimal) ymtCatalogsIWapper.selectMinfQuotePrice(productID).get(0).get("MinPrice")).setScale(2, BigDecimal.ROUND_HALF_UP);//最小单价
				
				//组装期待值
				Map<String, Object> tgtRetMap = new HashMap<String,Object>();
				if (iBrandId != 0) {
					tgtRetMap.put("BrandName", (String) productBrand.get(0).get("sBrand"));		//品牌英文名
					tgtRetMap.put("BrandEnName", (String) productBrand.get(0).get("sBrandEn"));		//品牌中文名
				}else{
					tgtRetMap.put("BrandName", jsonObjectBean.getJSONObject("JsonBeanRequest").getJSONObject("Product").getString("sBrandName"));		//自定义品牌名
				}

				tgtRetMap.put("MasterCategoryId", iMasterCategoryid);			//主类目ID
				tgtRetMap.put("MasterCategoryName", sMasterCategoryNamebySql);			//主类目名称
				tgtRetMap.put("CategoryName", sCategoryNamebySql);				//二级类目名称
				tgtRetMap.put("ThirdCategoryName", sThirdCategoryNamebySql);				//三级类目名称
				tgtRetMap.put("CountryId", iCountrybySql);		//国家id
				tgtRetMap.put("DeliveryMethod", iCatalogStatus);	//物流方式 1国内 2海外直邮 3护航 4保税 6海外认证直邮 7海外拼邮
				tgtRetMap.put("BondedArea", iBondedArea);	//保税区
				tgtRetMap.put("IsNewDesc", true);	//是否新描述
				tgtRetMap.put("Weight", iWeight);	//运费
				tgtRetMap.put("MaxCatalogPrice", String.valueOf(maxfQuotePrice));	//最大单价
				tgtRetMap.put("MinCatalogPrice", String.valueOf(minfQuotePrice));	//最小单价
				tgtRetMap.put("IsNew", bisnew);			//IsNew			
				if (!jsonObjectBean.getJSONObject("JsonBeanRequest").getJSONObject("Product").isNull("ProductCode")) {
					String productCode = jsonObjectBean.getJSONObject("JsonBeanRequest").getJSONObject("Product").getString("ProductCode");
					tgtRetMap.put("ProductCode", productCode);
				}	
				tgtRetMap.put("IsTop", isTop);	
				tgtRetMap.put("IsNew", isNew);					
				
				AssertService.assertResultEqual(tgtRetMap, productDetailModelMap);			
				//首次露出时间、新品结束时间
//				AssertService.assertTime(dListingTime, (Date)productDetailModelMap.get("NewStartTime"), 1000);
//				AssertService.assertTime(dNewEndtime, (Date)productDetailModelMap.get("NewEndTime"), 1000);
				
				//Mongo CatalogList
				JSONArray mongoCatalogList = new JSONArray(productDetailModelMap.get("CatalogList").toString());  //Mongo 
				JSONArray sourceCatalogList = jsonObjectBean.getJSONObject("JsonBeanRequest").getJSONObject("Product").getJSONArray("Catalogs");
				
					for(int i = 0;i < mongoCatalogList.length();i ++){
						
						//获取Mongo第i条CatalogList记录
						JSONObject mongoCatalogObj = mongoCatalogList.getJSONObject(i);		
						
						//获取Mongo中的SKU
						String sku = mongoCatalogObj.getString("SKU");
						String catalogidbysql = (String) ymtCatalogsIWapper.selectCatalogsByProductIdandSku(productID, sku).get(0).get("sCatalogId");//sql取出规格id
						
						Logger.verifyEquals(catalogidbysql, mongoCatalogObj.getString("CatalogId"), "Mongo规格id对比");
						
						//根据报文+sku 返回对应的catalogs请求报文
						JSONObject sourceObj =	returnOneCatalogsbyJsonbean(jsonObjectBean, sku);
						
						
						if (jsonObjectBean.getJSONObject("JsonBeanRequest").getJSONObject("Product").getJSONArray("Catalogs").length() > 1) {
							//PropertyList 商品规格描述
							JSONArray mongoPropertyList = mongoCatalogObj.getJSONArray("PropertyList");
							for(int j = 0;j < mongoPropertyList.length();j++){
								String propertyName = sourceObj.getJSONArray("PropertyValues").getJSONObject(j).getString("PropertyName");
								String PropertyValue = sourceObj.getJSONArray("PropertyValues").getJSONObject(j).getJSONArray("PropertyValues").getJSONObject(0).getString("PropertyValue");
							
								Logger.verifyEquals(propertyName, mongoPropertyList.getJSONObject(j).get("Name"), "Mongo规格名称对比：第"+j+"个");
								Logger.verifyEquals(PropertyValue, mongoPropertyList.getJSONObject(j).get("Value"), "Mongo规格值对比：第"+j+"个");
							}
							
						}

															
							//PriceList 商品价格
							JSONArray mongoPriceList = mongoCatalogObj.getJSONArray("PriceList");
							for(int k = 0;k < mongoPriceList.length();k++){
								
								if (mongoPriceList.getJSONObject(k).getInt("PriceType") == 0 ) {
									BigDecimal price = new BigDecimal(sourceObj.getString("Price")).setScale(2, BigDecimal.ROUND_HALF_UP);	//报文取出商品原价
									BigDecimal pricebymongo = new BigDecimal(mongoPriceList.getJSONObject(k).getString("Price")).setScale(2, BigDecimal.ROUND_HALF_UP);
									
									Logger.verifyEquals("原价", mongoPriceList.getJSONObject(k).getString("Reason"), "Mongo商品价格类别对比"+k);
									Logger.verifyEquals(price, pricebymongo, "Mongo商品原价对比"+k);
								}
								
								
								
								else if (mongoPriceList.getJSONObject(k).getInt("PriceType") == 1) {
									BigDecimal newCustomerPrice = new BigDecimal(sourceObj.getString("NewCustomerPrice")).setScale(2, BigDecimal.ROUND_HALF_UP);	//报文取出商品新客价
									BigDecimal newCustomerPricebymongo = new BigDecimal(mongoPriceList.getJSONObject(k).getString("Price")).setScale(2, BigDecimal.ROUND_HALF_UP);
									
									Logger.verifyEquals("新客价", mongoPriceList.getJSONObject(k).getString("Reason"), "Mongo商品价格类别对比"+k);
									Logger.verifyEquals(newCustomerPrice, newCustomerPricebymongo, "Mongo商品新客价对比"+k);
								}
								
								
								
								else if (mongoPriceList.getJSONObject(k).getInt("PriceType") == 2) {
									BigDecimal vipPrice = new BigDecimal(sourceObj.getString("VipPrice")).setScale(2, BigDecimal.ROUND_HALF_UP);	//报文取出商品VIP价格
									BigDecimal vipPricebymongo = new BigDecimal(mongoPriceList.getJSONObject(k).getString("Price")).setScale(2, BigDecimal.ROUND_HALF_UP);									
									
									Logger.verifyEquals("VIP价", mongoPriceList.getJSONObject(k).getString("Reason"), "Mongo商品价格类别对比"+k);
									Logger.verifyEquals(vipPrice, vipPricebymongo, "Mongo商品VIP价对比"+k);
								}
								
								
								
								else if (mongoPriceList.getJSONObject(k).getInt("PriceType") == 5) {
									BigDecimal earnestPrice = new BigDecimal(sourceObj.getString("EarnestPrice")).setScale(2, BigDecimal.ROUND_HALF_UP);	//报文取出商品定金
									BigDecimal earnestPricebymongo = new BigDecimal(mongoPriceList.getJSONObject(k).getString("Price")).setScale(2, BigDecimal.ROUND_HALF_UP);									
									
									Logger.verifyEquals("定金价", mongoPriceList.getJSONObject(k).getString("Reason"), "Mongo商品价格类别对比"+k);
									Logger.verifyEquals(earnestPrice, earnestPricebymongo, "Mongo商品定金对比"+k);
								}
								
								
							
							//StockList 商品库存
							JSONArray mongoStockList = mongoCatalogObj.getJSONArray("StockList");
							for(int l = 0;l < mongoStockList.length();l++){
									int stockbysourceObj = sourceObj.getInt("Num");	//报文取出商品库存
									Logger.verifyEquals(0, mongoStockList.getJSONObject(l).get("StockType"), "Mongo库存类别对比");
									Logger.verifyEquals(stockbysourceObj, mongoStockList.getJSONObject(l).get("Stock"), "Mongo库存数量对比");
								
								}	
								
							}
							
					}
				
					
				
				
				
				
				
				/**
				 * ProductDescriptionModel 商品描述表
				 */
				ProductDescriptionModelWapper productDescriptionModelWapper = new ProductDescriptionModelWapper();
				Logger.verifyEquals(1, productDescriptionModelWapper.getCountByProductId(productID), "商品数据应该只有1条");
				
				Map<String,Object> productDescriptionModel= productDescriptionModelWapper.getProductId(productID);
				
				//SQL 查询商品描述
				List<Map> productDescription  = ymtProductsIWapper.selectDescConfigByProductId(productID);
				String sWordContent = (String) productDescription.get(0).get("WordContent");
				String sPictureUrl = (String) productDescription.get(0).get("PictureUrl");
				
				Logger.verifyIsContains(sWordContent, productDescriptionModel, "商品文字描述");
				Logger.verifyIsContains(sPictureUrl, productDescriptionModel, "商品图片描述");
				
				
				
				/**
				 * ProductListingModel 商品简单详情表
				 */
				ProductListingModelWapper productListingModelWapper = new ProductListingModelWapper();
				Logger.verifyEquals(1, productListingModelWapper.getCountByProductId(productID), "商品数据应该只有1条");
				//Mongo取出实际结果
				Map<String,Object> actRetMapbyproductListingModel = productListingModelWapper.getProductId(productID);
				
				//商品数量总数
				int catalogstock = (int) ymtCatalogsIWapper.selectSumStock(productID).get(0).get("");
								
				//组装期待结果
				JSONObject requestAddProduct = jsonObjectBean.getJSONObject("JsonBeanRequest");
				Map<String, Object> tgtRetMapbyproductListingModel = new HashMap<String, Object>();
				tgtRetMapbyproductListingModel.put("Title", jsonObjectBean.getJSONObject("JsonBeanRequest").getJSONObject("Product").getString("ProductName"));
				tgtRetMapbyproductListingModel.put("MainPic", jsonObjectBean.getJSONObject("JsonBeanRequest").getJSONObject("Product").getString("PictureUrl1"));
				tgtRetMapbyproductListingModel.put("SellerId", jsonObjectBean.getJSONObject("JsonBeanRequest").getInt("UserID"));
				tgtRetMapbyproductListingModel.put("SellerName", jsonObjectBean.getJSONObject("JsonBeanRequest").getString("LoginID"));
				tgtRetMapbyproductListingModel.put("CountryId", iCountrybySql);		//国家id
				tgtRetMapbyproductListingModel.put("MaxCatalogPrice", String.valueOf(maxfQuotePrice));	//最大单价
				tgtRetMapbyproductListingModel.put("MinCatalogPrice", String.valueOf(minfQuotePrice));	//最小单价			
				tgtRetMapbyproductListingModel.put("CatalogStock", catalogstock);	//商品总数
				tgtRetMapbyproductListingModel.put("Action", jsonObjectBean.getJSONObject("JsonBeanRequest").getJSONObject("Product").getJSONArray("Catalogs").getJSONObject(0).getString("Action"));	//商品总数
				
				tgtRetMapbyproductListingModel.put("TariffType", requestAddProduct.getJSONObject("Product").getInt("TariffType"));	//保税
				tgtRetMapbyproductListingModel.put("DeliveryMethod", iCatalogStatus);	//物流方式
				//是否包邮取决于邮费价格
				tgtRetMapbyproductListingModel.put("IsFreeShipping",  requestAddProduct.getJSONObject("Product").getInt("Flight")==0?true:false);	//是否包邮
				
				
				AssertService.assertResultEqual(tgtRetMapbyproductListingModel, actRetMapbyproductListingModel,"ProductListingModel");
		    	
				
				//上架下架时间
				if ("null".equals(jsonObjectBean.getJSONObject("JsonBeanRequest").getJSONObject("Product").getString("ValidStart"))) {
					AssertService.assertTime(YMTDateUtil.getDate(), (Date)actRetMapbyproductListingModel.get("ValidStart"), 1000);
					AssertService.assertTime(YMTDateUtil.getBeforeOrNextDate(7), (Date)actRetMapbyproductListingModel.get("ValidEnd"), 1000);
				}else {
					Date sValidStart = YMTDateUtil.parseYMDHMSDate(jsonObjectBean.getJSONObject("JsonBeanRequest").getJSONObject("Product").getString("ValidStart"));
					Date sValidEnd = YMTDateUtil.parseYMDHMSDate(jsonObjectBean.getJSONObject("JsonBeanRequest").getJSONObject("Product").getString("ValidEnd"));
					
					AssertService.assertTime(sValidStart, (Date)actRetMapbyproductListingModel.get("ValidStart"), 1000);
					AssertService.assertTime(sValidEnd, (Date)actRetMapbyproductListingModel.get("ValidEnd"), 1000);
				}
				
	    }catch (Exception e) {
	        e.printStackTrace();
	    }
	}		
	
	
	
	/**
	 * 取jsonObjectBean的实例
	 * JSONObject jsonObjectBean  = new AddNewSellerProductCall().callAndGetReturnData(jsonbean); 
	 * 
	 * 根据报文和sku返回对应的Catalog的报文信息
	 * @param jsonObjectBean 完整的返回报文+请求报文
	 * @param sku 商品sku
	 * @return 返回对应的Catalog的报文信息
	 * @throws Exception
	 */
	public static JSONObject returnOneCatalogsbyJsonbean (JSONObject jsonObjectBean,String sku) throws Exception {
	    try {
		    	        
		    	JSONArray sourceCatalogList = jsonObjectBean.getJSONObject("JsonBeanRequest").getJSONObject("Product").getJSONArray("Catalogs");

		    	JSONObject jCatalogList = null;
		    	for (int i = 0; i < sourceCatalogList.length(); i++) {
		    		if (sku.equals(sourceCatalogList.getJSONObject(i).getString("SKU"))) {
		    			jCatalogList = sourceCatalogList.getJSONObject(i);
		    		}
		    	}			
		    	return jCatalogList;
						
	    }catch (Exception e) {
	        e.printStackTrace();
	    }
		return null;
	}	
	
	
	
	
	
	
}